package com.jacen.fzxs.entity;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Table;

import com.jacen.fzxs.entity.web.Wall;
import com.jacen.fzxs.util.DateUtils;

/**
 * 墙体实体类
 * @author Jacen
 * 2014年9月3日 下午2:30:50
 */
@Table(name = "t_wall")
public class WallEntity extends BaseEntity {
	
	private String province;//省
	private String city;//市
	private String county; //县
	private String town; //乡镇
	private String address;
	@Column(name="location_x")
	private Double locationX;//维度
	@Column(name="location_y")
	private Double locationY;//经度
	private String high;//gao
	private String width;//kuan
	private String area;//面积
	private String price;//价格
	private Integer lv;//等级
	private String images;//照片
	private Integer status;//0空白、1自租、2他租
	private String memo;//备注
	@Column(name="create_time")
	private String createTime;//创建时间
	private String username;//姓名 
	private String tel;//联系方式
	
	public String getProvince() {
		return province;
	}
	public void setProvince(String province) {
		this.province = province;
	}
	public String getCity() {
		return city;
	}
	public void setCity(String city) {
		this.city = city;
	}
	public String getCounty() {
		return county;
	}
	public void setCounty(String county) {
		this.county = county;
	}
	public String getTown() {
		return town;
	}
	public void setTown(String town) {
		this.town = town;
	}
	public Double getLocationX() {
		return locationX;
	}
	public void setLocationX(Double locationX) {
		this.locationX = locationX;
	}
	public Double getLocationY() {
		return locationY;
	}
	public void setLocationY(Double locationY) {
		this.locationY = locationY;
	}
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public String getCreateTime() {
		return createTime;
	}
	public void setCreateTime(String createTime) {
		this.createTime = createTime;
	}
	public String getImages() {
		return images;
	}
	public void setImages(String images) {
		this.images = images;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getTel() {
		return tel;
	}
	public void setTel(String tel) {
		this.tel = tel;
	}
	public Integer getLv() {
		return lv;
	}
	public void setLv(Integer lv) {
		this.lv = lv;
	}
	public Integer getStatus() {
		return status;
	}
	public String getHigh() {
		return high;
	}
	public void setHigh(String high) {
		this.high = high;
	}
	public String getWidth() {
		return width;
	}
	public void setWidth(String width) {
		this.width = width;
	}
	public String getArea() {
		return area;
	}
	public void setArea(String area) {
		this.area = area;
	}
	public String getPrice() {
		return price;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	public void setPrice(String price) {
		this.price = price;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder("墙体信息\n");
		sb.append("\n地址:").append(province).append(city).append(county).append(address)
		.append("\n宽度:").append(width).append(" 高度:").append(high).append(" 面积:").append(area)
		.append("\n姓名:").append(username).append("\n联系方式:").append(tel);
		return sb.toString();
	}
	
	public static WallEntity turnToWall(Wall wall){
		WallEntity entity = new WallEntity();
		entity.setProvince(wall.getProvince());
		entity.setCity(wall.getCity());
		entity.setCounty(wall.getDistrict());
		entity.setAddress(wall.getAddress());
		entity.setArea(wall.getArea());
		entity.setCreateTime(DateUtils.date2Str(new Date(), DateUtils.NORMAL_FORMAT));
		entity.setHigh(wall.getHigh());
		entity.setWidth(wall.getWidth());
		entity.setLocationY(Double.valueOf(wall.getLat()));
		entity.setLocationX(Double.valueOf(wall.getLon()));
		entity.setUsername(wall.getUserName());
		entity.setPrice(wall.getPrice());
		entity.setTel(wall.getTel());
		return entity;
	}
	

}
